from db_init import engine, person_table
from sqlalchemy.sql import or_, and_

"""
    多个条件的查询，需要引入or和and函数 
"""

with engine.connect() as conn:
    query = person_table.select().where(
        or_(
            person_table.c.name == "name1",
            and_(
                person_table.c.time > '2024-1-1',
                person_table.c.id < 5
            )
        )
    )
    result_set = conn.execute(query)

    row = result_set.fetchall() # 返回的list列表
    print(row)
